#include <stdio.h>
#include <stdarg.h>
#include "usart.h"

int my_log(const char * fmt, ...)
{
	char buf[128];
	va_list ap;
	
	va_start(ap, fmt);
	
	int len = vsnprintf(buf, sizeof(buf), fmt, ap);
	
	va_end(ap);
	
	if(len >= sizeof(buf))
	{
		return -1;
	}
	
	HAL_USART_Transmit(&husart1, (uint8_t*)buf, len, 1000);
	
	return 0;
}
